var express = require('express');
var router  = new express.Router();
var userService = require('../service/user')


router.get('/login',function (req,res) {
   var user = {
       username:req.query.username,
       password:req.query.password
   }

   /*1. 同步方式 */
/*   var flag = userService.login(user);
   res.send({
       login:flag
   })*/

    /*2. 异步方式 */
   userService.login(user,function (error,result) {
         if(result.length==0){
             res.send({
                 flag:false
             })
         }else{
             res.send({
                 flag:true
             })
         }
    })

})


module.exports = router;